package adfc.game;

/**
 * Created by IntelliJ IDEA.
 * User: aimozg
 * Date: 31.12.11
 * Time: 18:00
 */
public class Block {
    private static final Block[] blockById = new Block[Short.MAX_VALUE];

    public final short id;
    public boolean solid = true;

    protected Block solid(boolean value) {
        this.solid = value;
        return this;
    }

    protected Block() {
        this.id = g_id();
        blockById[id] = this;
    }

    public static Block forId(int id) {
        return blockById[id];
    }

    private static short g_id = 0;

    protected static short g_id() {
        return g_id++;
    }

    public static final Block B_EMPTY = new Block().solid(false);
    public static final Block B_STONE = new Block();
    public static final Block B_MINERAL = new Block();

    public static final short BID_EMPTY = B_EMPTY.id;
    public static final short BID_STONE = B_STONE.id;
    public static final short BID_MINERAL = B_MINERAL.id;
}
